package mylittleinvestigations.Events;

import java.util.ArrayList;
import mylittleinvestigations.Location;

public class LocationEventProvider
{
    private static ArrayList<LocationEventListener> listenerList = new ArrayList<LocationEventListener>();
    
    public static void RegisterListener(LocationEventListener listener)
    {
        if (!listenerList.contains(listener))
        {
            listenerList.add(listener);
        }
    }
    
    public static void ClearListener(LocationEventListener listener)
    {
        listenerList.remove(listener);
    }
    
    public static void RaiseExited(Location sender, Location targetLocation)
    {
        for (int i = 0; i < listenerList.size(); i++)
        {
            listenerList.get(i).OnLocationExited(sender, targetLocation);
        }
    }
}
